package com.gmail.hongyz.myfuse.dataengine;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class Record {

	public static final int STATE_NONE = 0;
	public static final int STATE_INSERT = 1;
	public static final int STATE_UPDATE = 2;
	public static final int STATE_DELETE = 3;
	  
	private Map<String, Object> data;
	private int state;
	
	public Record() {
		data = new HashMap<String, Object>();
	}
	
	public Record(Map<String, Object> data) {
		this.data = data;
	}
	
	public Object get(String key) {
		return data.get(key);
	}
	
	public void set(String key, Object value) {
		data.put(key, value);
	}
	
	public Iterator<String> keys() {
		return data.keySet().iterator();
	}
	
	public Map<String, Object> toMap() {
		return data;
	}
	
	@Override
	public String toString() {
		return getClass() + ": [state:" + state + ", data: "+ data.toString() + "]";
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}
}
